package com.catsic.pub.specification;

import org.apache.commons.lang3.StringUtils;

import com.catsic.base.conditon.Condition;
import com.catsic.base.specification.BaseSpec;
import com.catsic.base.specification.QueryWraper;
import com.catsic.pub.condition.FtpCondition;
import com.catsic.pub.entity.Ftp;


public class FtpSpec extends BaseSpec<Ftp> {

	public FtpSpec(Condition condition) {
		super(condition);
	}

	@Override
	protected void addCondition(QueryWraper<Ftp> queryWraper) {
		FtpCondition condition = (FtpCondition) getCondition();
		/**
		 * 端口
		 */
		if(condition.getFtpport() != null){
			addEqualCondition(queryWraper, "ftpport");
		}
		/**
		 * 用户名
		 */
		if(StringUtils.isNotBlank(condition.getFtpuser())){
		  addLikeCondition(queryWraper, "ftpuser",condition.getFtpuser());
		}
		/**
		 * 所属机构
		 */
		if(StringUtils.isNotBlank(condition.getOrganName())){
			addLikeCondition(queryWraper, "organName",condition.getOrganName());
		}
	}
	

}
